//
//  YuYueModel.m
//  FD
//
//  Created by Yasin on 2018/10/23.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//

#import "YuYueOrderModel.h"

@implementation YuYueOrderModel
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
    return @{@"yuyueId":@"id"};
}

- (void)setShop:(NSDictionary *)shop {
    _shop = shop;
    
    _thumbnail = [NSString stringWithFormat:@"%@%@",kPicDomain,shop[@"thumbnail"]];
    _name = shop[@"name"];
}




- (void)setCreateTime:(NSNumber *)createTime {
    _createTime = createTime;
    _createtimeStr = [self stringFromTimeStamp:[NSString stringWithFormat:@"%@",createTime]];
}

- (void)setDiningTime:(NSNumber *)diningTime {
    _diningTime  = diningTime;
    
    _diningTimeStr = [self stringFromTimeStamp:[NSString stringWithFormat:@"%@",diningTime]];
}


//时间戳转时间
- (NSString *)stringFromTimeStamp:(NSString *)timeStamp {
    // timeStampString 是服务器返回的13位时间戳：精确到毫秒
    
    //只需要精确到秒
    NSTimeInterval interval = [timeStamp doubleValue] / 1000;
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];

    
    //日期格式化类
    NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
    [fmt setDateFormat:@"yyyy-MM-dd HH:mm"];

    NSString *dateStr = [fmt stringFromDate:date];

    return dateStr;
}


@end
